<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>date</title>
	</head>
	<body>
		<div id="div1"></div>
		<script>
			var count1 = setInterval(fun11,1000);
			function fun11(){
			var date1 = new Date();
		
			var hour = date1.getHours();
			function getAmPm() {
				var hour = date1.getHours();
				if (hour>=0&&hour<=12) {
					return "am";
				} else{
					return "pm";
				}
			}
			
			var minutes = date1.getMinutes();
			var seconds = date1.getSeconds();
			function formatTime(seconds) {
			    // 将秒数转换为字符串，并确保至少有两位数
			    return seconds.toString().padStart(2, '0');
			}
		
			// var div1 = document.getElementById("div1");
		
			div1.innerHTML = "现在是："+hour+"时"+minutes+"分"+formatTime(seconds)+"秒"+getAmPm();
			}
		</script>
	</body>
</html>